class Tag < ActiveRecord::Base
  validates_presence_of :name
  has_many :questions
  has_many :demands

  def Tag.store_tag params
    @tag = Tag.find_by(:name=>params[:tag_id])
    if !@tag
      @tag = Tag.new({:name=>params[:tag_id]})
      @tag.save
    else
      @tag.update_attribute(:use_time,@tag.use_time+1)
    end
    return @tag
  end
end
